package com.zmyuan.demo.netty.thrift.service;

import com.zmyuan.demo.netty.thrift.Content;
import com.zmyuan.demo.netty.thrift.Msg;
import com.zmyuan.demo.netty.thrift.utils.ThriftUtils;

/**
 * Created by zdb on 2017/2/17.
 */
public class ThriftService {

    public String saveMsg(Msg msg) {
         byte[] dst = msg.getContent();
        try {
            Content content = ThriftUtils.convertBytesToObject(dst, Content.class);
            return content.getPhone();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public Content saveContent(Content content) {
        System.out.println(content.getPhone());
        return content;
    }
}
